<!doctype html>



  


<html class="theme-next mist use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>



<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />












  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />




  
  
  
  

  
    
    
  

  

  

  

  

  
    
    
    <link href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic&subset=latin,latin-ext" rel="stylesheet" type="text/css">
  






<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.0" rel="stylesheet" type="text/css" />


  <meta name="keywords" content="Bos项目," />








  <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico?v=5.1.0" />






<meta name="description" content="起向高楼撞晓钟，不信人间耳尽聋  BaseAction1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980public class BaseActi">
<meta name="keywords" content="Bos项目">
<meta property="og:type" content="article">
<meta property="og:title" content="bos-all">
<meta property="og:url" content="http://yoursite.com/2017/06/03/bos-all/index.html">
<meta property="og:site_name" content="JokerLiang">
<meta property="og:description" content="起向高楼撞晓钟，不信人间耳尽聋  BaseAction1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980public class BaseActi">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2017-06-03T05:38:35.010Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="bos-all">
<meta name="twitter:description" content="起向高楼撞晓钟，不信人间耳尽聋  BaseAction1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980public class BaseActi">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Mist',
    sidebar: {"position":"left","display":"always"},
    fancybox: true,
    motion: true,
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://yoursite.com/2017/06/03/bos-all/"/>





  <title> bos-all | JokerLiang </title>
</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  








  <div style="display: none;">
    <script src="//s95.cnzz.com/z_stat.php?id=1260895995&web_id=1260895995" language="JavaScript"></script>
  </div>





  
  
    
  

  <div class="container one-collumn sidebar-position-left page-post-detail ">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-meta ">
  

  <div class="custom-logo-site-title">
    <a href="/"  class="brand" rel="start">
      <span class="logo-line-before"><i></i></span>
      <span class="site-title">JokerLiang</span>
      <span class="logo-line-after"><i></i></span>
    </a>
  </div>
  <p class="site-subtitle">永远年轻，永远热泪盈眶。</p>
</div>

<div class="site-nav-toggle">
  <button>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
    <span class="btn-bar"></span>
  </button>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup">
 <span class="search-icon fa fa-search"></span>
 <input type="text" id="local-search-input">
 <div id="local-search-result"></div>
 <span class="popup-btn-close">close</span>
</div>


    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal " itemscope itemtype="http://schema.org/Article">
  <link itemprop="mainEntityOfPage" href="http://yoursite.com/2017/06/03/bos-all/">

  <span style="display:none" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <meta itemprop="name" content="JokerLiang">
    <meta itemprop="description" content="">
    <meta itemprop="image" content="/images/me.jpg">
  </span>

  <span style="display:none" itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
    <meta itemprop="name" content="JokerLiang">
    <span style="display:none" itemprop="logo" itemscope itemtype="http://schema.org/ImageObject">
      <img style="display:none;" itemprop="url image" alt="JokerLiang" src="">
    </span>
  </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">
            
            
              
                bos-all
              
            
          </h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>
              <time title="Post created" itemprop="dateCreated datePublished" datetime="2017-06-03T13:32:57+08:00">
                2017-06-03
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
              <span class="post-meta-divider">|</span>
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/Bos项目/" itemprop="url" rel="index">
                    <span itemprop="name">Bos项目</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
          

          

          
          

          

          

        </div>
      </header>
    


    <div class="post-body" itemprop="articleBody">

      
      

      
        <blockquote>
<p>&#x8D77;&#x5411;&#x9AD8;&#x697C;&#x649E;&#x6653;&#x949F;&#xFF0C;&#x4E0D;&#x4FE1;&#x4EBA;&#x95F4;&#x8033;&#x5C3D;&#x804B;</p>
</blockquote>
<h2 id="BaseAction"><a href="#BaseAction" class="headerlink" title="BaseAction"></a>BaseAction</h2><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">BaseAction</span>&lt;<span class="title">T</span>&gt; <span class="keyword">extends</span> <span class="title">ActionSupport</span> <span class="keyword">implements</span> <span class="title">ModelDriven</span>&lt;<span class="title">T</span>&gt; </span>{</span><br><span class="line">	<span class="keyword">protected</span> PageBean pageBean = <span class="keyword">new</span> PageBean();</span><br><span class="line">	<span class="keyword">protected</span> T model;</span><br><span class="line">	<span class="keyword">protected</span> String LIST = <span class="string">&quot;list&quot;</span> ;</span><br><span class="line">	<span class="keyword">protected</span> DetachedCriteria dc =  <span class="keyword">null</span> ;</span><br><span class="line"></span><br><span class="line">	</span><br><span class="line">	</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setPage</span><span class="params">(Integer page)</span> </span>{</span><br><span class="line">		pageBean.setCurrentPage(page);</span><br><span class="line">	}</span><br><span class="line"></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setRows</span><span class="params">(Integer rows)</span> </span>{</span><br><span class="line">		pageBean.setPageSize(rows);</span><br><span class="line">	}</span><br><span class="line"></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="title">BaseAction</span><span class="params">()</span></span>{</span><br><span class="line">		ParameterizedType genericSuperclass = (ParameterizedType) <span class="keyword">this</span>.getClass().getGenericSuperclass();</span><br><span class="line">		</span><br><span class="line">		Type[] actualTypeArguments = genericSuperclass.getActualTypeArguments();</span><br><span class="line">		Class&lt;T&gt; entityClass = (Class&lt;T&gt;) actualTypeArguments[<span class="number">0</span>];</span><br><span class="line">		dc = DetachedCriteria.forClass(entityClass);</span><br><span class="line">		pageBean.setDetachedCriteria(dc);</span><br><span class="line">		 <span class="comment">//&#x53CD;&#x5C04;&#x521B;&#x5EFA;&#x5B9E;&#x4F8B;</span></span><br><span class="line">		<span class="keyword">try</span> {</span><br><span class="line">			model = entityClass.newInstance();</span><br><span class="line">		} <span class="keyword">catch</span> (InstantiationException e) {</span><br><span class="line">			e.printStackTrace();</span><br><span class="line">		} <span class="keyword">catch</span> (IllegalAccessException e) {</span><br><span class="line">			e.printStackTrace();</span><br><span class="line">		}</span><br><span class="line">	}</span><br><span class="line">	</span><br><span class="line">	<span class="meta">@Override</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> T <span class="title">getModel</span><span class="params">()</span> </span>{</span><br><span class="line">		<span class="comment">//</span></span><br><span class="line">		<span class="keyword">return</span> model;</span><br><span class="line">	}</span><br><span class="line">	</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">	<span class="comment">/**</span></span><br><span class="line"><span class="comment">	 * &#x5C06;&#x6307;&#x5B9A;Java&#x5BF9;&#x8C61;&#x8F6C;&#x4E3A;json&#xFF0C;&#x5E76;&#x54CD;&#x5E94;&#x5230;&#x5BA2;&#x6237;&#x7AEF;&#x9875;&#x9762;</span></span><br><span class="line"><span class="comment">	 * <span class="doctag">@param</span> object</span></span><br><span class="line"><span class="comment">	 * <span class="doctag">@param</span> exclude &#x6392;&#x9664;&#x7684;&#x5B57;&#x6BB5;</span></span><br><span class="line"><span class="comment">	 */</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">java2Json</span><span class="params">(Object object , String[] exclude)</span></span>{</span><br><span class="line">		JsonConfig jsonConfig = <span class="keyword">new</span> JsonConfig();</span><br><span class="line">		<span class="comment">//&#x8BBE;&#x7F6E;&#x4E0D;&#x9700;&#x8981;&#x8F6C;&#x6362;&#x4E3A;Json&#x7684;&#x5B57;&#x6BB5;</span></span><br><span class="line">		jsonConfig.setExcludes(exclude);</span><br><span class="line">		JSONObject jsonObject = JSONObject.fromObject(object,jsonConfig);</span><br><span class="line">		String jsonStr = jsonObject.toString();</span><br><span class="line">		ServletActionContext.getResponse().setContentType(<span class="string">&quot;text/json;charset=UTF-8&quot;</span>);</span><br><span class="line">		<span class="keyword">try</span> {</span><br><span class="line">			ServletActionContext.getResponse().getWriter().write(jsonStr);</span><br><span class="line">		} <span class="keyword">catch</span> (IOException e) {</span><br><span class="line">			<span class="comment">// TODO Auto-generated catch block</span></span><br><span class="line">			e.printStackTrace();</span><br><span class="line">		}</span><br><span class="line">	}</span><br><span class="line">	</span><br><span class="line">	<span class="comment">/**</span></span><br><span class="line"><span class="comment">	 * &#x5C06;&#x6307;&#x5B9A;Java&#x96C6;&#x5408;&#x8F6C;&#x4E3A;json&#xFF0C;&#x5E76;&#x54CD;&#x5E94;&#x5230;&#x5BA2;&#x6237;&#x7AEF;&#x9875;&#x9762;</span></span><br><span class="line"><span class="comment">	 * <span class="doctag">@param</span> o</span></span><br><span class="line"><span class="comment">	 * <span class="doctag">@param</span> exclueds</span></span><br><span class="line"><span class="comment">	 */</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">java2Json</span><span class="params">(List o ,String[] exclueds)</span></span>{</span><br><span class="line">		JsonConfig jsonConfig = <span class="keyword">new</span> JsonConfig();</span><br><span class="line">		<span class="comment">//&#x6307;&#x5B9A;&#x54EA;&#x4E9B;&#x5C5E;&#x6027;&#x4E0D;&#x9700;&#x8981;&#x8F6C;json</span></span><br><span class="line">		jsonConfig.setExcludes(exclueds);</span><br><span class="line">		String json = JSONArray.fromObject(o,jsonConfig).toString();</span><br><span class="line">		ServletActionContext.getResponse().setContentType(<span class="string">&quot;text/json;charset=utf-8&quot;</span>);</span><br><span class="line">		<span class="keyword">try</span> {</span><br><span class="line">			ServletActionContext.getResponse().getWriter().print(json);</span><br><span class="line">		} <span class="keyword">catch</span> (IOException e) {</span><br><span class="line">			e.printStackTrace();</span><br><span class="line">		}</span><br><span class="line">	}</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<a id="more"></a>
<h2 id="BaseDao"><a href="#BaseDao" class="headerlink" title="BaseDao"></a>BaseDao</h2><h3 id="Dao"><a href="#Dao" class="headerlink" title="Dao"></a>Dao</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br></pre></td><td class="code"><pre><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">interface</span> <span class="title">BaseDao</span>&lt;<span class="title">T</span>&gt; </span>{</span><br><span class="line">	<span class="function"><span class="keyword">void</span> <span class="title">save</span><span class="params">(T t)</span></span>;</span><br><span class="line">	<span class="function"><span class="keyword">void</span> <span class="title">delect</span><span class="params">(T t)</span></span>;</span><br><span class="line">	<span class="function"><span class="keyword">void</span> <span class="title">update</span><span class="params">(T t)</span></span>;</span><br><span class="line">	<span class="function">T <span class="title">findById</span><span class="params">(Serializable id)</span></span>;</span><br><span class="line">	<span class="function">List&lt;T&gt; <span class="title">findAll</span><span class="params">()</span></span>;</span><br><span class="line">	</span><br><span class="line">	<span class="comment">/**</span></span><br><span class="line"><span class="comment">	 * &#x901A;&#x7528;&#x7684;&#x66F4;&#x65B0;&#x8BED;&#x53E5;&#xFF0C;&#x7B2C;&#x4E00;&#x4E2A;&#x53C2;&#x6570;&#x4E3A;&#x5728;*&#x3002;</span></span><br><span class="line"><span class="comment">	 * <span class="doctag">@param</span> queryName</span></span><br><span class="line"><span class="comment">	 * <span class="doctag">@param</span> object</span></span><br><span class="line"><span class="comment">	 */</span></span><br><span class="line">	<span class="function"><span class="keyword">void</span> <span class="title">executeUpdate</span><span class="params">(String queryName,Object... objects)</span></span>;</span><br><span class="line">	</span><br><span class="line">	<span class="comment">/**</span></span><br><span class="line"><span class="comment">	 * &#x5206;&#x9875;&#x67E5;&#x8BE2;&#x7684;&#x65B9;&#x6CD5;</span></span><br><span class="line"><span class="comment">	 * <span class="doctag">@param</span> pageBean</span></span><br><span class="line"><span class="comment">	 */</span></span><br><span class="line">	<span class="function"><span class="keyword">void</span> <span class="title">pageQuery</span><span class="params">(PageBean pageBean)</span></span>;</span><br><span class="line">	</span><br><span class="line">	<span class="function"><span class="keyword">void</span> <span class="title">saveOrUpdate</span><span class="params">(T t)</span></span>;</span><br><span class="line">	</span><br><span class="line">	<span class="comment">/**</span></span><br><span class="line"><span class="comment">	 * &#x901A;&#x7528;&#x7684;&#x67E5;&#x8BE2;&#x65B9;&#x6CD5;</span></span><br><span class="line"><span class="comment">	 * <span class="doctag">@param</span> dc</span></span><br><span class="line"><span class="comment">	 * <span class="doctag">@return</span></span></span><br><span class="line"><span class="comment">	 */</span></span><br><span class="line">	<span class="function">List&lt;T&gt; <span class="title">findByCriteria</span><span class="params">(DetachedCriteria dc)</span></span>;</span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<h3 id="Impl"><a href="#Impl" class="headerlink" title="Impl"></a>Impl</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.joker.bos.dao.impl;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">BaseDaoImpl</span>&lt;<span class="title">T</span>&gt; <span class="keyword">extends</span> <span class="title">HibernateDaoSupport</span> <span class="keyword">implements</span> <span class="title">BaseDao</span>&lt;<span class="title">T</span>&gt; </span>{</span><br><span class="line"></span><br><span class="line">	<span class="keyword">private</span> Class clazz;</span><br><span class="line">	</span><br><span class="line">	<span class="comment">//&#x56E0;&#x4E3A;&#x662F;&#x4F7F;&#x7528;&#x6CE8;&#x89E3;&#x7684;&#x65B9;&#x5F0F;&#xFF0C;&#x6240;&#x4EE5;&#x8FD9;&#x91CC;&#x9700;&#x8981;&#x5305;&#x88C5;&#x4E0B;</span></span><br><span class="line">	<span class="meta">@Resource</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">setMySessionFactory</span><span class="params">(SessionFactory sessionFactory)</span></span>{</span><br><span class="line">		<span class="keyword">super</span>.setSessionFactory(sessionFactory);</span><br><span class="line">	}</span><br><span class="line">	</span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="title">BaseDaoImpl</span><span class="params">()</span></span>{</span><br><span class="line">		ParameterizedType ptClass = (ParameterizedType) <span class="keyword">this</span>.getClass().getGenericSuperclass();</span><br><span class="line">		clazz=(Class) ptClass.getActualTypeArguments()[<span class="number">0</span>];</span><br><span class="line">	}</span><br><span class="line">	<span class="meta">@Override</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">save</span><span class="params">(T t)</span> </span>{</span><br><span class="line">		getHibernateTemplate().save(t);</span><br><span class="line">	}</span><br><span class="line"></span><br><span class="line">	<span class="meta">@Override</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">delect</span><span class="params">(T t)</span> </span>{</span><br><span class="line">		getHibernateTemplate().delete(t);</span><br><span class="line">		</span><br><span class="line">	}</span><br><span class="line"></span><br><span class="line">	<span class="meta">@Override</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">update</span><span class="params">(T t)</span> </span>{</span><br><span class="line">		getHibernateTemplate().update(t);</span><br><span class="line">		</span><br><span class="line">	}</span><br><span class="line"></span><br><span class="line">	<span class="meta">@Override</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> T <span class="title">findById</span><span class="params">(Serializable id)</span> </span>{</span><br><span class="line">		<span class="keyword">return</span> (T) getHibernateTemplate().get(clazz, id);</span><br><span class="line">	}</span><br><span class="line"></span><br><span class="line">	<span class="meta">@Override</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> List&lt;T&gt; <span class="title">findAll</span><span class="params">()</span> </span>{</span><br><span class="line">		String hql  = <span class="string">&quot;from &quot;</span>+clazz.getSimpleName();</span><br><span class="line">		<span class="keyword">return</span> (List&lt;T&gt;) getHibernateTemplate().find(hql);</span><br><span class="line">	}</span><br><span class="line"></span><br><span class="line">	<span class="meta">@Override</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">executeUpdate</span><span class="params">(String queryName, Object... objects)</span> </span>{</span><br><span class="line">		Session session = <span class="keyword">this</span>.getSessionFactory().getCurrentSession();</span><br><span class="line">		Query query = session.getNamedQuery(queryName);</span><br><span class="line">		<span class="keyword">int</span> i = <span class="number">0</span>;</span><br><span class="line">		<span class="keyword">for</span> (Object object : objects) {</span><br><span class="line">			<span class="comment">//&#x4E3A;HQL&#x8BED;&#x53E5;&#x4E2D;&#x7684;&#xFF1F;&#x8D4B;&#x503C;</span></span><br><span class="line">			query.setParameter(i++, object);</span><br><span class="line">		}</span><br><span class="line">		<span class="comment">//&#x6267;&#x884C;&#x66F4;&#x65B0;</span></span><br><span class="line">		query.executeUpdate();</span><br><span class="line"></span><br><span class="line">	}</span><br><span class="line"></span><br><span class="line">	<span class="meta">@Override</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">pageQuery</span><span class="params">(PageBean pageBean)</span> </span>{</span><br><span class="line">		Integer currentPage = pageBean.getCurrentPage();</span><br><span class="line">		Integer pageSize = pageBean.getPageSize();</span><br><span class="line">		DetachedCriteria dc = pageBean.getDetachedCriteria();</span><br><span class="line">		<span class="comment">//&#x53D6;&#x51FA;Action&#x5C01;&#x88C5;&#x597D;&#x7684;&#x3002;</span></span><br><span class="line">		<span class="comment">//&#x8BBE;&#x7F6E;&#x67E5;&#x8BE2;&#x603B;&#x6570;&#x91CF;</span></span><br><span class="line">		dc.setProjection(Projections.rowCount());</span><br><span class="line">		<span class="comment">//&#x5236;&#x5B9A;Hibernate&#x7684;&#x5C01;&#x88C5;&#x65B9;&#x5F0F;</span></span><br><span class="line">		dc.setResultTransformer(DetachedCriteria.ROOT_ENTITY);</span><br><span class="line">		List&lt;Long&gt; list = (List&lt;Long&gt;) getHibernateTemplate().findByCriteria(dc);</span><br><span class="line">		Long total = list.get(<span class="number">0</span>);</span><br><span class="line">		pageBean.setTotal(total.intValue());</span><br><span class="line">		<span class="comment">//&#x6E05;&#x695A;&#x4E0A;&#x9762;&#x8BBE;&#x7F6E;&#x7684;&#x51FD;&#x6570;</span></span><br><span class="line">		dc.setProjection(<span class="keyword">null</span>);</span><br><span class="line">		<span class="keyword">int</span> firstResult = (currentPage - <span class="number">1</span>) * pageSize;</span><br><span class="line">		<span class="keyword">int</span> maxResults  = pageSize;</span><br><span class="line">		List  rows = getHibernateTemplate().findByCriteria(dc, firstResult, maxResults);</span><br><span class="line">		pageBean.setRows(rows);</span><br><span class="line">	}</span><br><span class="line"></span><br><span class="line">	<span class="meta">@Override</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">saveOrUpdate</span><span class="params">(T t)</span> </span>{</span><br><span class="line">		<span class="keyword">this</span>.getHibernateTemplate().saveOrUpdate(t);</span><br><span class="line">		</span><br><span class="line">	}</span><br><span class="line"></span><br><span class="line">	<span class="meta">@Override</span></span><br><span class="line">	<span class="function"><span class="keyword">public</span> List&lt;T&gt; <span class="title">findByCriteria</span><span class="params">(DetachedCriteria dc)</span> </span>{</span><br><span class="line">		<span class="keyword">return</span> (List&lt;T&gt;) <span class="keyword">this</span>.getHibernateTemplate().findByCriteria(dc);</span><br><span class="line">	}</span><br><span class="line"></span><br><span class="line">}</span><br></pre></td></tr></table></figure>
<h2 id="Spring&#x914D;&#x7F6E;&#x6587;&#x4EF6;"><a href="#Spring&#x914D;&#x7F6E;&#x6587;&#x4EF6;" class="headerlink" title="Spring&#x914D;&#x7F6E;&#x6587;&#x4EF6;"></a>Spring&#x914D;&#x7F6E;&#x6587;&#x4EF6;</h2><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br></pre></td><td class="code"><pre><span class="line">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span><br><span class="line"><span class="tag">&lt;<span class="name">beans</span> <span class="attr">xmlns</span>=<span class="string">&quot;http://www.springframework.org/schema/beans&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">xmlns:xsi</span>=<span class="string">&quot;http://www.w3.org/2001/XMLSchema-instance&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">xmlns:context</span>=<span class="string">&quot;http://www.springframework.org/schema/context&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">xmlns:aop</span>=<span class="string">&quot;http://www.springframework.org/schema/aop&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">xmlns:tx</span>=<span class="string">&quot;http://www.springframework.org/schema/tx&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">xmlns:jaxws</span>=<span class="string">&quot;http://cxf.apache.org/jaxws&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">xmlns:soap</span>=<span class="string">&quot;http://cxf.apache.org/bindings/soap&quot;</span></span></span><br><span class="line"><span class="tag">	<span class="attr">xsi:schemaLocation</span>=<span class="string">&quot;http://www.springframework.org/schema/beans </span></span></span><br><span class="line"><span class="tag"><span class="string">						http://www.springframework.org/schema/beans/spring-beans.xsd</span></span></span><br><span class="line"><span class="tag"><span class="string">						http://www.springframework.org/schema/context</span></span></span><br><span class="line"><span class="tag"><span class="string">						http://www.springframework.org/schema/context/spring-context.xsd</span></span></span><br><span class="line"><span class="tag"><span class="string">						http://www.springframework.org/schema/aop</span></span></span><br><span class="line"><span class="tag"><span class="string">						http://www.springframework.org/schema/aop/spring-aop.xsd</span></span></span><br><span class="line"><span class="tag"><span class="string">						http://www.springframework.org/schema/tx </span></span></span><br><span class="line"><span class="tag"><span class="string">						http://www.springframework.org/schema/tx/spring-tx.xsd</span></span></span><br><span class="line"><span class="tag"><span class="string">						http://cxf.apache.org/bindings/soap </span></span></span><br><span class="line"><span class="tag"><span class="string">						http://cxf.apache.org/schemas/configuration/soap.xsd</span></span></span><br><span class="line"><span class="tag"><span class="string">						http://cxf.apache.org/jaxws </span></span></span><br><span class="line"><span class="tag"><span class="string">						http://cxf.apache.org/schemas/jaxws.xsd&quot;</span></span></span><br><span class="line"><span class="tag">						</span></span><br><span class="line"><span class="tag">						&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- &#x6CE8;&#x518C;crm&#x5BA2;&#x6237;&#x7AEF;&#x4EE3;&#x7406;&#x5BF9;&#x8C61; --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">jaxws:client</span> <span class="attr">id</span>=<span class="string">&quot;crmClient&quot;</span> </span></span><br><span class="line"><span class="tag">		<span class="attr">serviceClass</span>=<span class="string">&quot;com.joker.crm.CustomerSrevice&quot;</span> </span></span><br><span class="line"><span class="tag">		<span class="attr">address</span>=<span class="string">&quot;http://localhost:8080/crmService/service/customer&quot;</span>/&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- &#x52A0;&#x8F7D;&#x5916;&#x90E8;&#x5C5E;&#x6027;&#x6587;&#x4EF6; --&gt;</span>					</span><br><span class="line">	<span class="tag">&lt;<span class="name">context:property-placeholder</span> <span class="attr">location</span>=<span class="string">&quot;classpath:db.properties&quot;</span>/&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- &#x5F00;&#x542F;&#x6CE8;&#x89E3;&#x7EC4;&#x4EF6;&#x626B;&#x63CF; --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">context:component-scan</span> <span class="attr">base-package</span>=<span class="string">&quot;com.joker.bos&quot;</span> /&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- &#x652F;&#x6301;Spring&#x6CE8;&#x89E3; --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">context:annotation-config</span> /&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">tx:annotation-driven</span>/&gt;</span></span><br><span class="line">	</span><br><span class="line"> </span><br><span class="line">	</span><br><span class="line">	</span><br><span class="line">	<span class="comment">&lt;!-- &#x52A0;&#x8F7D;&#x6570;&#x636E;&#x6E90; --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">bean</span> <span class="attr">id</span>=<span class="string">&quot;dataSource&quot;</span> <span class="attr">class</span>=<span class="string">&quot;com.mchange.v2.c3p0.ComboPooledDataSource&quot;</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;driverClass&quot;</span> <span class="attr">value</span>=<span class="string">&quot;${jdbc.driverClass}&quot;</span>/&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;jdbcUrl&quot;</span> <span class="attr">value</span>=<span class="string">&quot;${jdbc.jdbcUrl}&quot;</span>/&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;user&quot;</span> <span class="attr">value</span>=<span class="string">&quot;${jdbc.user}&quot;</span>/&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;password&quot;</span> <span class="attr">value</span>=<span class="string">&quot;${jdbc.password}&quot;</span>/&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">bean</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="comment">&lt;!-- &#x914D;&#x7F6E;LocalSessionFactoryBean&#xFF0C;spring&#x63D0;&#x4F9B;&#x7684;&#x7528;&#x4E8E;&#x6574;&#x5408;hibernate&#x7684;&#x5DE5;&#x5382;bean --&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="tag">&lt;<span class="name">bean</span> <span class="attr">id</span>=<span class="string">&quot;sessionFactory&quot;</span> <span class="attr">class</span>=<span class="string">&quot;org.springframework.orm.hibernate5.LocalSessionFactoryBean&quot;</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;dataSource&quot;</span> <span class="attr">ref</span>=<span class="string">&quot;dataSource&quot;</span>/&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- &#x6CE8;&#x5165;hibernate&#x76F8;&#x5173;&#x7684;&#x5C5E;&#x6027;&#x914D;&#x7F6E; --&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;hibernateProperties&quot;</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">props</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">prop</span> <span class="attr">key</span>=<span class="string">&quot;hibernate.dialect&quot;</span>&gt;</span>org.hibernate.dialect.MySQL5Dialect<span class="tag">&lt;/<span class="name">prop</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">prop</span> <span class="attr">key</span>=<span class="string">&quot;hibernate.hbm2ddl.auto&quot;</span>&gt;</span>update<span class="tag">&lt;/<span class="name">prop</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">prop</span> <span class="attr">key</span>=<span class="string">&quot;hibernate.show_sql&quot;</span>&gt;</span>true<span class="tag">&lt;/<span class="name">prop</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">prop</span> <span class="attr">key</span>=<span class="string">&quot;hibernate.format_sql&quot;</span>&gt;</span>true<span class="tag">&lt;/<span class="name">prop</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;/<span class="name">props</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- &#x6CE8;&#x5165;hibernate&#x7684;&#x6620;&#x5C04;&#x6587;&#x4EF6; --&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;mappingLocations&quot;</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">list</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">value</span>&gt;</span>classpath:com/joker/bos/domain/*.xml<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;/<span class="name">list</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">bean</span>&gt;</span></span><br><span class="line"></span><br><span class="line">	</span><br><span class="line">	<span class="comment">&lt;!-- &#x914D;&#x7F6E;&#x4E8B;&#x52A1;&#x7BA1;&#x7406;&#x5668; --&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="tag">&lt;<span class="name">bean</span> <span class="attr">id</span>=<span class="string">&quot;transactionManager&quot;</span> <span class="attr">class</span>=<span class="string">&quot;org.springframework.orm.hibernate5.HibernateTransactionManager&quot;</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;sessionFactory&quot;</span> <span class="attr">ref</span>=<span class="string">&quot;sessionFactory&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">bean</span>&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="comment">&lt;!-- &#x914D;&#x7F6E;shiro&#x6846;&#x67B6;&#x7684;&#x8FC7;&#x6EE4;&#x5668;&#x5DE5;&#x5382;&#x5BF9;&#x8C61; --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">bean</span> <span class="attr">id</span>=<span class="string">&quot;shiroFilter&quot;</span> <span class="attr">class</span>=<span class="string">&quot;org.apache.shiro.spring.web.ShiroFilterFactoryBean&quot;</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- &#x6CE8;&#x5165;&#x5B89;&#x5168;&#x7BA1;&#x7406;&#x5668;&#x5BF9;&#x8C61; --&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;securityManager&quot;</span> <span class="attr">ref</span>=<span class="string">&quot;securityManager&quot;</span>/&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- &#x6CE8;&#x5165;&#x76F8;&#x5173;&#x9875;&#x9762;&#x8BBF;&#x95EE;URL --&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;loginUrl&quot;</span> <span class="attr">value</span>=<span class="string">&quot;/login.jsp&quot;</span>/&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;successUrl&quot;</span> <span class="attr">value</span>=<span class="string">&quot;/index.jsp&quot;</span>/&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;unauthorizedUrl&quot;</span> <span class="attr">value</span>=<span class="string">&quot;/unauthorized.jsp&quot;</span>/&gt;</span></span><br><span class="line">		<span class="comment">&lt;!--&#x6CE8;&#x5165;URL&#x62E6;&#x622A;&#x89C4;&#x5219; --&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;filterChainDefinitions&quot;</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">value</span>&gt;</span></span><br><span class="line">				/css/** = anon</span><br><span class="line">				/js/** = anon</span><br><span class="line">				/images/** = anon</span><br><span class="line">				/validatecode.jsp* = anon</span><br><span class="line">				/login.jsp* = anon</span><br><span class="line">				/userAction_login = anon</span><br><span class="line">				/page_base_staff.action = perms[&quot;staff-list&quot;]</span><br><span class="line">				/**  = authc</span><br><span class="line">			<span class="tag">&lt;/<span class="name">value</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">bean</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="comment">&lt;!-- &#x6CE8;&#x518C;&#x5B89;&#x5168;&#x7BA1;&#x7406;&#x5668;&#x5BF9;&#x8C61; --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">bean</span> <span class="attr">id</span>=<span class="string">&quot;securityManager&quot;</span> <span class="attr">class</span>=<span class="string">&quot;org.apache.shiro.web.mgt.DefaultWebSecurityManager&quot;</span>&gt;</span></span><br><span class="line">		 <span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;realm&quot;</span> <span class="attr">ref</span> = <span class="string">&quot;bosRealm&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line">		 <span class="comment">&lt;!-- &#x628A;&#x7F13;&#x5B58;&#x7BA1;&#x7406;&#x5668;&#x6CE8;&#x5165;&#x5B89;&#x5168;&#x7BA1;&#x7406;&#x5668; --&gt;</span></span><br><span class="line">		 <span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;cacheManager&quot;</span> <span class="attr">ref</span>=<span class="string">&quot;cacheManager&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">bean</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="comment">&lt;!-- &#x6CE8;&#x518C;&#x7F13;&#x5B58;&#x7BA1;&#x7406;&#x5668; --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">bean</span> <span class="attr">id</span>=<span class="string">&quot;cacheManager&quot;</span> <span class="attr">class</span>=<span class="string">&quot;org.apache.shiro.cache.ehcache.EhCacheManager&quot;</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- &#x6CE8;&#x5165;ehcache&#x914D;&#x7F6E;&#x6587;&#x4EF6; --&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;cacheManagerConfigFile&quot;</span> <span class="attr">value</span>=<span class="string">&quot;classpath:ehcache.xml&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">bean</span>&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- &#x6CE8;&#x518C;&#x81EA;&#x5B9A;&#x4E49;realm --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">bean</span> <span class="attr">id</span>=<span class="string">&quot;bosRealm&quot;</span> <span class="attr">class</span>=<span class="string">&quot;com.joker.bos.realm.BosRealm&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">bean</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">	<span class="comment">&lt;!-- &#x5F00;&#x542F;shiro&#x6CE8;&#x89E3;&#x914D;&#x7F6E;&#xFF0C;&#x5FC5;&#x987B;&#x4F7F;&#x7528;cglib&#x65B9;&#x5F0F;&#x4E3A;Action&#x521B;&#x5EFA;&#x4EE3;&#x7406;&#x5BF9;&#x8C61; --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">bean</span> <span class="attr">id</span>=<span class="string">&quot;defaultAdvisorAutoProxyCreator&quot;</span> </span></span><br><span class="line"><span class="tag">	<span class="attr">class</span>=<span class="string">&quot;org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator&quot;</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- &#x6539;&#x4E3A;true&#x8868;&#x793A;&#x4F7F;&#x7528;cglib&#xFF0C;false&#x8868;&#x793A;&#x4F7F;&#x7528;jdk&#x7684; --&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">property</span> <span class="attr">name</span>=<span class="string">&quot;proxyTargetClass&quot;</span> <span class="attr">value</span>=<span class="string">&quot;true&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">property</span>&gt;</span></span><br><span class="line">	<span class="tag">&lt;/<span class="name">bean</span>&gt;</span></span><br><span class="line">	<span class="comment">&lt;!--  &#x914D;&#x7F6E;shiro&#x6846;&#x67B6;&#x63D0;&#x4F9B;&#x7684;&#x5207;&#x9762;&#x7C7B;&#xFF0C;&#x7528;&#x4E8E;&#x521B;&#x5EFA;&#x4EE3;&#x7406;&#x5BF9;&#x8C61; --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">bean</span> <span class="attr">class</span>=<span class="string">&quot;org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor&quot;</span>/&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">beans</span>&gt;</span></span><br></pre></td></tr></table></figure>
<h2 id="Struts2&#x914D;&#x7F6E;&#x6587;&#x4EF6;"><a href="#Struts2&#x914D;&#x7F6E;&#x6587;&#x4EF6;" class="headerlink" title="Struts2&#x914D;&#x7F6E;&#x6587;&#x4EF6;"></a>Struts2&#x914D;&#x7F6E;&#x6587;&#x4EF6;</h2><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br></pre></td><td class="code"><pre><span class="line">&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</span><br><span class="line"><span class="meta">&lt;!DOCTYPE struts PUBLIC</span></span><br><span class="line"><span class="meta">    &quot;-//Apache Software Foundation//DTD Struts Configuration 2.3//EN&quot;</span></span><br><span class="line"><span class="meta">    &quot;http://struts.apache.org/dtds/struts-2.3.dtd&quot;&gt;</span></span><br><span class="line"><span class="tag">&lt;<span class="name">struts</span>&gt;</span></span><br><span class="line">	<span class="comment">&lt;!-- &#x662F;&#x5426;&#x6253;&#x5F00; &#x5F00;&#x53D1;&#x8005;&#x6A21;&#x5F0F; --&gt;</span></span><br><span class="line">	<span class="tag">&lt;<span class="name">constant</span> <span class="attr">name</span>=<span class="string">&quot;struts.devMode&quot;</span> <span class="attr">value</span>=<span class="string">&quot;false&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">constant</span>&gt;</span></span><br><span class="line"></span><br><span class="line">	<span class="tag">&lt;<span class="name">package</span> <span class="attr">name</span>=<span class="string">&quot;basicstruts2&quot;</span> <span class="attr">extends</span>=<span class="string">&quot;struts-default&quot;</span> <span class="attr">namespace</span>=<span class="string">&quot;/&quot;</span>&gt;</span></span><br><span class="line">	</span><br><span class="line">		<span class="comment">&lt;!-- &#x914D;&#x7F6E;&#x62E6;&#x622A;&#x5668; --&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">interceptors</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">interceptor</span> <span class="attr">name</span>=<span class="string">&quot;BosLoginInterCetor&quot;</span> <span class="attr">class</span>=<span class="string">&quot;com.joker.bos.web.interceptor.BosLoginInterCeptor&quot;</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">param</span> <span class="attr">name</span>=<span class="string">&quot;excludeMethods&quot;</span>&gt;</span>login<span class="tag">&lt;/<span class="name">param</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;/<span class="name">interceptor</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">interceptor-stack</span> <span class="attr">name</span>=<span class="string">&quot;BosLoginInterCeptorStack&quot;</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">interceptor-ref</span> <span class="attr">name</span>=<span class="string">&quot;BosLoginInterCetor&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">interceptor-ref</span>&gt;</span></span><br><span class="line">				<span class="tag">&lt;<span class="name">interceptor-ref</span> <span class="attr">name</span>=<span class="string">&quot;defaultStack&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">interceptor-ref</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;/<span class="name">interceptor-stack</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">interceptors</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- &#x91CD;&#x65B0;&#x5236;&#x5B9A;&#x9ED8;&#x8BA4;&#x62E6;&#x622A;&#x5668;&#x6808; --&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">default-interceptor-ref</span> <span class="attr">name</span>=<span class="string">&quot;BosLoginInterCeptorStack&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">default-interceptor-ref</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- &#x914D;&#x7F6E;&#x5168;&#x5C40;&#x7ED3;&#x679C;&#x96C6; --&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">global-results</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">result</span> <span class="attr">name</span>=<span class="string">&quot;login&quot;</span> <span class="attr">type</span>=<span class="string">&quot;redirect&quot;</span>&gt;</span>/login.jsp<span class="tag">&lt;/<span class="name">result</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">result</span> <span class="attr">name</span>=<span class="string">&quot;unauthorized&quot;</span> <span class="attr">type</span>=<span class="string">&quot;redirect&quot;</span>&gt;</span>/unauthorized.jsp<span class="tag">&lt;/<span class="name">result</span>&gt;</span></span><br><span class="line">			</span><br><span class="line">		<span class="tag">&lt;/<span class="name">global-results</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">global-exception-mappings</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">exception-mapping</span> <span class="attr">result</span>=<span class="string">&quot;unauthorized&quot;</span> <span class="attr">exception</span>=<span class="string">&quot;org.apache.shiro.authz.UnauthorizedException&quot;</span>&gt;</span><span class="tag">&lt;/<span class="name">exception-mapping</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">global-exception-mappings</span>&gt;</span></span><br><span class="line">		<span class="comment">&lt;!-- &#x9700;&#x8981;&#x8FDB;&#x884C;&#x6743;&#x9650;&#x63A7;&#x5236;&#x7684;&#x9875;&#x9762;&#x8BBF;&#x95EE; --&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">action</span> <span class="attr">name</span>=<span class="string">&quot;page_*_*&quot;</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">result</span> <span class="attr">type</span>=<span class="string">&quot;dispatcher&quot;</span>&gt;</span>/WEB-INF/pages/{1}/{2}.jsp<span class="tag">&lt;/<span class="name">result</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">action</span>&gt;</span></span><br><span class="line">		</span><br><span class="line">		<span class="comment">&lt;!-- &#x7528;&#x6237;&#x7BA1;&#x7406; --&gt;</span></span><br><span class="line">		<span class="tag">&lt;<span class="name">action</span> <span class="attr">name</span>=<span class="string">&quot;userAction_*&quot;</span> <span class="attr">class</span>=<span class="string">&quot;userAction&quot;</span> <span class="attr">method</span>=<span class="string">&quot;{1}&quot;</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">result</span> <span class="attr">name</span>=<span class="string">&quot;home&quot;</span>&gt;</span>/index.jsp<span class="tag">&lt;/<span class="name">result</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">result</span> <span class="attr">name</span>=<span class="string">&quot;list&quot;</span>&gt;</span>/WEB-INF/pages/admin/userlist.jsp<span class="tag">&lt;/<span class="name">result</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">action</span>&gt;</span></span><br><span class="line">		</span><br><span class="line">		<span class="tag">&lt;<span class="name">action</span> <span class="attr">name</span>=<span class="string">&quot;staffAction_*&quot;</span> <span class="attr">class</span>=<span class="string">&quot;staffAction&quot;</span> <span class="attr">method</span>=<span class="string">&quot;{1}&quot;</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">result</span> <span class="attr">name</span>=<span class="string">&quot;list&quot;</span>&gt;</span>/WEB-INF/pages/base/staff.jsp<span class="tag">&lt;/<span class="name">result</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">action</span>&gt;</span></span><br><span class="line">		</span><br><span class="line">		<span class="tag">&lt;<span class="name">action</span> <span class="attr">name</span>=<span class="string">&quot;regionAction_*&quot;</span> <span class="attr">class</span>=<span class="string">&quot;regionAction&quot;</span> <span class="attr">method</span>=<span class="string">&quot;{1}&quot;</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">result</span> <span class="attr">name</span>=<span class="string">&quot;list&quot;</span>&gt;</span>/WEB-INF/pages/base/region.jsp<span class="tag">&lt;/<span class="name">result</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">action</span>&gt;</span></span><br><span class="line">		</span><br><span class="line">		<span class="tag">&lt;<span class="name">action</span> <span class="attr">name</span>=<span class="string">&quot;testAction_*&quot;</span> <span class="attr">class</span>=<span class="string">&quot;testAction&quot;</span> <span class="attr">method</span>=<span class="string">&quot;{1}&quot;</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">action</span>&gt;</span></span><br><span class="line"></span><br><span class="line">		<span class="tag">&lt;<span class="name">action</span> <span class="attr">name</span>=<span class="string">&quot;subareaAction_*&quot;</span> <span class="attr">class</span>=<span class="string">&quot;subareaAction&quot;</span> <span class="attr">method</span>=<span class="string">&quot;{1}&quot;</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">result</span> <span class="attr">name</span>=<span class="string">&quot;tolist&quot;</span>  &gt;</span>/WEB-INF/pages/base/subarea.jsp<span class="tag">&lt;/<span class="name">result</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">action</span>&gt;</span></span><br><span class="line">		</span><br><span class="line">		<span class="tag">&lt;<span class="name">action</span> <span class="attr">name</span>=<span class="string">&quot;decidedZoneAction_*&quot;</span> <span class="attr">class</span>=<span class="string">&quot;decidedZoneAction&quot;</span> <span class="attr">method</span>=<span class="string">&quot;{1}&quot;</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">result</span> <span class="attr">name</span>=<span class="string">&quot;list&quot;</span>&gt;</span>/WEB-INF/pages/base/decidedzone.jsp<span class="tag">&lt;/<span class="name">result</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">action</span>&gt;</span></span><br><span class="line"></span><br><span class="line">		<span class="tag">&lt;<span class="name">action</span> <span class="attr">name</span>=<span class="string">&quot;noticebillAction_*&quot;</span> <span class="attr">class</span>=<span class="string">&quot;noticebillAction&quot;</span> <span class="attr">method</span>=<span class="string">&quot;{1}&quot;</span>&gt;</span></span><br><span class="line">			<span class="tag">&lt;<span class="name">result</span> <span class="attr">name</span>=<span class="string">&quot;list&quot;</span>&gt;</span>/WEB-INF/pages/qupai/noticebill_add.jsp<span class="tag">&lt;/<span class="name">result</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">action</span>&gt;</span></span><br><span class="line">		</span><br><span class="line">		<span class="tag">&lt;<span class="name">action</span> <span class="attr">name</span>=<span class="string">&quot;workordermanageAction_*&quot;</span> <span class="attr">class</span>=<span class="string">&quot;workordermanageAction&quot;</span> <span class="attr">method</span>=<span class="string">&quot;{1}&quot;</span>&gt;</span></span><br><span class="line">			 </span><br><span class="line">		<span class="tag">&lt;/<span class="name">action</span>&gt;</span></span><br><span class="line">		</span><br><span class="line">		<span class="tag">&lt;<span class="name">action</span> <span class="attr">name</span>=<span class="string">&quot;functionAction_*&quot;</span> <span class="attr">class</span>=<span class="string">&quot;functionAction&quot;</span> <span class="attr">method</span>=<span class="string">&quot;{1}&quot;</span>&gt;</span></span><br><span class="line">			 <span class="tag">&lt;<span class="name">result</span> <span class="attr">name</span>=<span class="string">&quot;list&quot;</span>&gt;</span>/WEB-INF/pages/admin/function_add.jsp<span class="tag">&lt;/<span class="name">result</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">action</span>&gt;</span></span><br><span class="line">		</span><br><span class="line">		<span class="tag">&lt;<span class="name">action</span> <span class="attr">name</span>=<span class="string">&quot;roleAction_*&quot;</span> <span class="attr">class</span>=<span class="string">&quot;roleAction&quot;</span> <span class="attr">method</span>=<span class="string">&quot;{1}&quot;</span>&gt;</span></span><br><span class="line">			 <span class="tag">&lt;<span class="name">result</span> <span class="attr">name</span>=<span class="string">&quot;list&quot;</span>&gt;</span>/WEB-INF/pages/admin/role.jsp<span class="tag">&lt;/<span class="name">result</span>&gt;</span></span><br><span class="line">		<span class="tag">&lt;/<span class="name">action</span>&gt;</span></span><br><span class="line">		</span><br><span class="line">	<span class="tag">&lt;/<span class="name">package</span>&gt;</span></span><br><span class="line">	</span><br><span class="line"><span class="tag">&lt;/<span class="name">struts</span>&gt;</span></span><br></pre></td></tr></table></figure>
      
    </div>

    <div>
      
        

      
    </div>

    <div>
      
        

      
    </div>


    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Bos项目/" rel="tag"># Bos项目</a>
          
        </div>
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/06/03/bos-utils/" rel="next" title="bos-utils">
                <i class="fa fa-chevron-left"></i> bos-utils
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/06/07/Mybatis-1/" rel="prev" title="Mybatis-1">
                Mybatis-1 <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          
  <div class="comments" id="comments">
    
  </div>


        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap" >
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview sidebar-panel">
        <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <img class="site-author-image" itemprop="image"
               src="/images/me.jpg"
               alt="JokerLiang" />
          <p class="site-author-name" itemprop="name">JokerLiang</p>
          <p class="site-description motion-element" itemprop="description">永远年轻，永远热泪盈眶。</p>
        </div>
        <nav class="site-state motion-element">
          <div class="site-state-item site-state-posts">
            <a href="/archives">
              <span class="site-state-item-count">61</span>
              <span class="site-state-item-name">日志</span>
            </a>
          </div>

          
            <div class="site-state-item site-state-categories">
              <a href="/categories">
                <span class="site-state-item-count">15</span>
                <span class="site-state-item-name">分类</span>
              </a>
            </div>
          

          
            <div class="site-state-item site-state-tags">
              <a href="/tags">
                <span class="site-state-item-count">17</span>
                <span class="site-state-item-name">标签</span>
              </a>
            </div>
          

        </nav>

        

        <div class="links-of-author motion-element">
          
            
              <span class="links-of-author-item">
                <a href="https://github.com/LoverJoker" target="_blank" title="GitHub">
                  
                    <i class="fa fa-fw fa-github"></i>
                  
                  GitHub
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="https://www.zhihu.com/people/lover-easy-7/activities" target="_blank" title="Twitter">
                  
                    <i class="fa fa-fw fa-twitter"></i>
                  
                  Twitter
                </a>
              </span>
            
              <span class="links-of-author-item">
                <a href="http://weibo.com/2292572142/profile?rightmod=1&wvr=6&mod=personinfo" target="_blank" title="微博">
                  
                    <i class="fa fa-fw fa-globe"></i>
                  
                  微博
                </a>
              </span>
            
          
        </div>

        
        

        
        
          <div class="links-of-blogroll motion-element links-of-blogroll-inline">
            <div class="links-of-blogroll-title">
              <i class="fa  fa-fw fa-globe"></i>
              Friends
            </div>
            <ul class="links-of-blogroll-list">
              
                <li class="links-of-blogroll-item">
                  <a href="http://www.knight.ac.cn/" title="Knight" target="_blank">Knight</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://lzllzl.cn/" title="Zayvion" target="_blank">Zayvion</a>
                </li>
              
                <li class="links-of-blogroll-item">
                  <a href="http://chen97.com/" title="Chens" target="_blank">Chens</a>
                </li>
              
            </ul>
          </div>
        

        


      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#BaseAction"><span class="nav-number">1.</span> <span class="nav-text">BaseAction</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#BaseDao"><span class="nav-number">2.</span> <span class="nav-text">BaseDao</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Dao"><span class="nav-number">2.1.</span> <span class="nav-text">Dao</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Impl"><span class="nav-number">2.2.</span> <span class="nav-text">Impl</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Spring配置文件"><span class="nav-number">3.</span> <span class="nav-text">Spring配置文件</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Struts2配置文件"><span class="nav-number">4.</span> <span class="nav-text">Struts2配置文件</span></a></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright" >
  
  &copy; 
  <span itemprop="copyrightYear">2018</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">JokerLiang</span>
</div>


<div class="powered-by">
  由 <a class="theme-link" href="https://hexo.io">Hexo</a> 强力驱动
</div>

<div class="theme-info">
  主题 -
  <a class="theme-link" href="https://github.com/iissnan/hexo-theme-next">
    NexT.Mist
  </a>
</div>


        

        
      </div>
    </footer>

    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
    </div>
  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  



  
  <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>

  
  <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>

  
  <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>

  
  <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.0"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.0"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.0"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.0"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.0"></script>



  



  




	




  
  
  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length == 0) {
      search_path = "search.xml";
    }
    var path = "/" + search_path;
    // monitor main search box;

    function proceedsearch() {
      $("body").append('<div class="popoverlay">').css('overflow', 'hidden');
      $('.popup').toggle();
    }
    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';
      $.ajax({
        url: path,
        dataType: "xml",
        async: true,
        success: function( xmlResponse ) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = $( "entry", xmlResponse ).map(function() {
            return {
              title: $( "title", this ).text(),
              content: $("content",this).text(),
              url: $( "url" , this).text()
            };
          }).get();
          var $input = document.getElementById(search_id);
          var $resultContent = document.getElementById(content_id);
          $input.addEventListener('input', function(){
            var matchcounts = 0;
            var str='<ul class=\"search-result-list\">';
            var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
            $resultContent.innerHTML = "";
            if (this.value.trim().length > 1) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var content_index = [];
                var data_title = data.title.trim().toLowerCase();
                var data_content = data.content.trim().replace(/<[^>]+>/g,"").toLowerCase();
                var data_url = decodeURIComponent(data.url);
                var index_title = -1;
                var index_content = -1;
                var first_occur = -1;
                // only match artiles with not empty titles and contents
                if(data_title != '') {
                  keywords.forEach(function(keyword, i) {
                    index_title = data_title.indexOf(keyword);
                    index_content = data_content.indexOf(keyword);
                    if( index_title >= 0 || index_content >= 0 ){
                      isMatch = true;
                      if (i == 0) {
                        first_occur = index_content;
                      }
                    }

                  });
                }
                // show search results
                if (isMatch) {
                  matchcounts += 1;
                  str += "<li><a href='"+ data_url +"' class='search-result-title'>"+ data_title +"</a>";
                  var content = data.content.trim().replace(/<[^>]+>/g,"");
                  if (first_occur >= 0) {
                    // cut out 100 characters
                    var start = first_occur - 20;
                    var end = first_occur + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if(start == 0){
                      end = 50;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    var match_content = content.substring(start, end);
                    // highlight all keywords
                    keywords.forEach(function(keyword){
                      var regS = new RegExp(keyword, "gi");
                      match_content = match_content.replace(regS, "<b class=\"search-keyword\">"+keyword+"</b>");
                    });

                    str += "<p class=\"search-result\">" + match_content +"...</p>"
                  }
                  str += "</li>";
                }
              })};
            str += "</ul>";
            if (matchcounts == 0) { str = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>' }
            if (keywords == "") { str = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>' }
            $resultContent.innerHTML = str;
          });
          proceedsearch();
        }
      });}

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched == false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(function(e){
      $('.popup').hide();
      $(".popoverlay").remove();
      $('body').css('overflow', '');
    });
    $('.popup').click(function(e){
      e.stopPropagation();
    });
  </script>


  

  

  

  


</body>
</html>
